<style>
.content-group {background:#fff;border-radius: 0.5rem;margin-bottom:0.39rem}
.merchname {display:none}
.fui-tab-scroll .item a {color:#fff;font-weight:400}
.fui-tab-scroll .item.on,.fui-tab-scroll .item.on a{color:#fff;}
.fui-tab-scroll .item.on:before {background:linear-gradient(to right,rgba(255,255,255,1),rgba(255,255,255,0));}
.fui-icon-group .fui-icon-col {
    margin: 0.1rem 0;
}
.carousel {margin-top:0}
.fui-header:after {
	border-bottom: 0 solid #D9D9D9;
}
.fui-switch.fui-switch-warning:checked {
    border-color: #a558e2;
    background-color: #a558e2;
}
.btn.btn-danger-o {
	color: #d5aaf7;
	border: 1px solid #d5aaf7;
}
</style>
<div ng-include="sys_html('common/_header','','','jy_weishop')"></div>
<div class="fui-page fui-page-current page-goods-list" style="background: linear-gradient(#7c2fef, #a558e2);">
<div class='fui-content' style="top:0;background:none">
	<div class="topbg" style="position: relative;text-align:center;width:100%;height:4.5rem;">
		<div class="fui-header" style="background:none">
			<div class="fui-header-left" style="padding-left:0.5rem">
				<img style="height:1.2rem" ng-src="{{tomedia(pagedata.sale_live.logo) || '../addons/jy_weishop/resource/images/livelogo.png'}}"/>
			</div>
			<div class="title"></div>
			<div class="fui-header-right" style="padding-right:0.5rem;color:#fff">
				<i class="icon jinyunicon icon-liebiao" ng-click="access_json('jy_weishop/sale.live_index/')" style="font-size: 1rem;margin-right:10px"></i>
				<i class="icon jinyunicon icon-liaotian" ng-click="access_json('jy_weishop/member.index/')" style="font-size: 1rem;"></i>
			</div>
		</div>
	</div>
	<div class="fui-cell-title" style="margin:0 auto;text-align:center;margin-top:-2rem;font-size:0.6rem;color:#ddd">
	      ￥<span style="font-size:2rem;color:#fff">{{pagedata.mytotalfee || '0.00'}}</span><span ng-click="pagedata.get_feemodal(1)" style="margin-left:0.3rem"><i class="icon icon-icon" style="font-size:0.6rem;">明细</i></span>
	</div>
	<div class='content-empty' style="margin-left:auto;margin-right:auto;margin-top:0">
			<image class='icon' style="width:8rem;height:8rem;border-radius:0.5rem" src="../addons/jy_weishop/resource/images/wxappliveewm.png"/>
			<div style="margin-top:0.3rem">长按识别小程序进入主播端</div>
	</div>
	<div class="content-empty" style="margin-top:0.5rem" ng-if="pagedata.list.length>0">
		<a href="javascript:;" ng-click="access_json('jy_weishop/sale.live_add/')" class='btn btn-sm btn-danger-o external'style="border-radius: 100px;width:  7rem;font-size: .75rem">再创建一个</a>
	</div>
	<div class="live-list" style="padding:0 1rem" ng-if="pagedata.list.length>0">
            <div class="fui-list" style="border-radius:0.5rem;border-bottom: 0 solid #ededed; */" ng-repeat="item in pagedata.list">
                <div class="fui-list-media" style="background-image: url({{item.image || '../core/resource/images/nopic.jpg'}});background-position: center; background-repeat: no-repeat;background-size: cover;">
                    <a data-nocache="true">
                        <span class="live-living">
                                <i></i>{{item.liveingtitle}}
                         </span>
                    </a>
                </div>
                <div class="fui-list-inner">
                    <div data-nocache="true">
                        <h3 style="margin-top:0">{{item.name}}</h3>
                    </div>
					<div style="font-size:0.65rem;margin-top:0.2rem">
						<span class="member"><img class="avatar" style="border-radius:50%;width:1rem;height:1rem;" ng-src="{{item.member.avatar || '../core/resource/images/nopic.jpg'}}"></span>
						<span style="font-weight:400">{{item.anchor_name}}</span>
					</div>
                    <p>{{item.start_time}} 开播</p>
                    <div class="live-list-subscribe">
                        <div class="fui-tag fui-tag-danger fee-tag-zi">成交额 ￥{{item.totalfee || '0.00'}}</div>
						<span>
                            <a ng-click="pagedata.setgoods(item.id);" class="live-subscribe-a live-subscribe-full-a" style="border: 1px solid #a558e2;background:#a558e2;">设置商品</a>
							<!--<a ng-click="pagedata.setcoupon(item.id);" class="live-subscribe-a live-subscribe-full-a" style="margin-right:0.2rem">设置优惠券</a>-->
                        </span>
                    </div>
                </div>
            </div>
    </div>
	<div class="content-empty" style="margin-top:0.3rem" ng-if="!pagedata.list || pagedata.list.length<1">
		  <i class="icon jinyunicon icon-cry" style="width: 6rem;margin-bottom: 0.5rem;"></i><br/><p style="color: #999;font-size: .75rem">您还没有创建直播间！</p>
		  <a href="javascript:;" ng-click="access_json('jy_weishop/sale.live_add/')" class='btn btn-sm btn-danger-o external'style="border-radius: 100px;width:  7rem;font-size: .75rem">去创建一个吧</a>
	</div>
	<div ng-show="pagedata.loading" class='infinite-loading'><span class='fui-preloader'></span><span style="margin-left:1.5rem"> 正在加载...</span></div>
</div>
</div>
 <!--商品弹层 -->
<div ng-if="pagedata.showgoods" class="popup">
            <div class="popup-body">
			<div class="popup-center">
				<i class="closed icon icon-cuowu" ng-click="pagedata.showgoods=false"></i>
				<div class="inner" style="padding:0.5rem 0">
					<div ng-if="pagedata.goodslist.length>0" class="fui-list-group goods-list-group" style="margin-top:0;background:none;padding-bottom:2.5rem;height:20rem;overflow-y:scroll">
						<div ng-repeat="g in pagedata.goodslist" class="fui-list goods-item" style="background:#f9f9f9;border-radius:0.2rem;padding:0.4rem 0.2rem">
								<div class="fui-list-media">
									<img ng-src="{{tomedia(g.image) || '../core/resource/images/nopic.jpg'}}" class='round'/>
								</div>
								<div class='fui-list-inner'>
									<div class='subtitle'>{{g.title}}</div>
									<div class='text'><span class='text-danger'>￥{{g.price}}</span><div class="fui-tag fui-tag-danger fee-tag-zi" style="margin-left:0.15rem">主播赚 ￥{{g.getfee || '0.00'}}</div> 
									<input type="checkbox" value="{{g.appgoodsid}}" ng-checked="pagedata.post.goods_ids.indexOf(';'+g.appgoodsid+';')>=0" ng-click="pagedata.goselect(g.appgoodsid)" class="fui-switch fui-switch-warning fui-switch-small r-f" style="margin-right:0.5rem"/></div>
								</div>
						</div>
					</div>
					<div ng-if="!pagedata.goodslist || pagedata.goodslist.length<1" class="content-empty" style="margin-bottom:2rem">
						<i class='icon icon-cry'></i><br/> 没有任何可用的商品!
					</div>
					<div class="fui-navbar" style="z-index: 999">
							<a href="javascript:" ng-click="pagedata.setgoodstorooms()" class="nav-item btn btn-danger btn-confirm" style="border: 1px solid #a558e2;background:#a558e2;">确定导入选择的商品</a>
					</div>
				</div>
			</div>
			</div>
</div>
 <!--优惠券 -->
<div ng-if="pagedata.showcoupons" class="popup">
            <div class="popup-body">
			<div class="popup-center">
				<i class="closed icon icon-cuowu" ng-click="pagedata.showcoupons=false"></i>
						<div class="coupon-picker option-picker" style="border-radius:0.3rem;">
							<div class="option-picker-inner coupon-picker">
								<div ng-if="!pagedata.coupons || pagedata.coupons.length<1" class="content-empty" style="margin-bottom:2rem">
								<i class='icon icon-cry'></i><br/> 没有任何可用的优惠券!
								
								</div>
								<div ng-if="pagedata.coupons.length>0" class="coupon-list mini" style="min-height:15rem">
								<div ng-repeat="coupon in pagedata.coupons" class="coupon-item  {{coupon.color}} ">
									<div class="coupon-dots">
										<i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i>
									</div>
									<div class="coupon-left">
										<div class="single" ng-if="coupon.backtype == '0'"><span class="subtitle">￥</span>{{coupon.deduct}}</div>
										<div class="single" ng-if="coupon.backtype == '1'">{{coupon.discount}}折</div>
										<div class="single" ng-if="coupon.backtype == '2'">立返</div>
									</div>
									<div class="coupon-right" style="padding:0.3rem 0.5rem">
										<div class="title">{{coupon.title}}</div>
										<div style="font-size: 0.6rem;color: #fff;">{{coupon.title5}}</div>
										<div class="usetime">
											<div class="text">{{coupon.title4}}</div>
										</div>
									</div>
									<div class="coupon-after" style="width:auto">
										<input type="checkbox" value="{{coupon.id}}" ng-checked="pagedata.post.coupon_ids.indexOf(';'+coupon.id+';')>=0" ng-click="pagedata.gocoupon_select(coupon.id)" class="fui-switch fui-switch-warning fui-switch-small r-f" style="margin-right:0.5rem"/></div>
									</div>
								</div>
							</div>
						</div>
						<div class="fui-navbar" style="z-index: 999">
							<a href="javascript:" ng-click="pagedata.checkcoupon(1)" class="nav-item btn btn-danger btn-confirm" style="border: 1px solid #a558e2;background:#a558e2;">确定选择</a>
						</div>
					</div>
			</div>
			</div>
</div>
<div ng-include="sys_html('sale/common/_feemodal')"></div>
<div ng-include="sys_html('common/pluginnav',true)"></div>
<script>
	scope.tool.get_list('jy_weishop/sale.live_myrooms/getlist/order=ishot',true);
	scope.pagedata.scroll_bottom=function(){
		scope.tool.get_list('jy_weishop/sale.live_myrooms/getlist/');
	}
scope.pagedata.get_goods=function(e){
	$('#loading_show').show();
	if(e){
		scope.pagedata.goodslist=[]
		scope.pagedata.params.page=1
	}
	var query=scope.made_query(scope.pagedata.params);
	scope.get('jy_weishop/sale.get_data/get_goods/'+query,function(res){
		console.log(res);
		scope.pagedata.loading=false;
		$('#loading_show').hide();
		if(res.list.length==0){
			scope.pagedata.loaded=true;
			return;
		}
		if(res.list.length<scope.pagedata.psize){
			scope.pagedata.loaded=true;
		}
		if(!scope.pagedata.goodslist){
			scope.pagedata.goodslist=[];
		}
		res.list.forEach(function(row){
			scope.pagedata.goodslist.push(row);
		});
		scope.pagedata.params.page++;
		scope.$evalAsync();
	});
}
if(scope.pagedata.setgoods){
	scope.pagedata.scroll_bottom=function(){
		scope.pagedata.get_goods();
	}
}
scope.pagedata.get_coupons=function(e){
	$('#loading_show').show();
	if(e){
		scope.pagedata.coupons=[]
		scope.pagedata.params.page=1
	}
	var query=scope.made_query(scope.pagedata.params);
	scope.get('jy_weishop/sale.get_data/get_coupons/'+query,function(res){
		scope.pagedata.loading=false;
		$('#loading_show').hide();
		if(res.list.length==0){
			scope.pagedata.loaded=true;
			return;
		}
		if(res.list.length<scope.pagedata.psize){
			scope.pagedata.loaded=true;
		}
		if(!scope.pagedata.coupons){
			scope.pagedata.coupons=[];
		}
		res.list.forEach(function(row){
			scope.pagedata.coupons.push(row);
		});
		scope.pagedata.params.page++;
		scope.$evalAsync();
	});
}
if(scope.pagedata.setcoupon){
	scope.pagedata.scroll_bottom=function(){
		scope.pagedata.get_coupons();
	}
}
scope.pagedata.setgoods=function(id){
	scope.pagedata.showgoods=true;
	scope.pagedata.post.id=id;
	scope.pagedata.get_goods(1);
}
scope.pagedata.setcoupon=function(id){
	scope.pagedata.showcoupons=true;
	scope.pagedata.post.id=id;
	scope.pagedata.get_coupons(1);
}
scope.pagedata.goselect=function(value){
	var goodsids = scope.pagedata.post.goods_ids;
		if(goodsids==undefined || goodsids==''){
			goodsids=';';
		}
		if(goodsids.indexOf(';'+value+';')<0){
			goodsids=goodsids+value+';';
		}else{
			goodsids=goodsids.replace(';'+value+';',';');
			if(goodsids==';'){
				goodsids='';
			}
		}
	scope.pagedata.post.goods_ids = goodsids
}
scope.pagedata.gocoupon_select=function(value){
	var coupon_ids = scope.pagedata.post.coupon_ids;
		if(coupon_ids==undefined || coupon_ids==''){
			coupon_ids=';';
		}
		if(coupon_ids.indexOf(';'+value+';')<0){
			coupon_ids=coupon_ids+value+';';
		}else{
			coupon_ids=coupon_ids.replace(';'+value+';',';');
			if(coupon_ids==';'){
				coupon_ids='';
			}
		}
	scope.pagedata.post.coupon_ids = coupon_ids
}
scope.pagedata.setgoodstorooms=function(){
	scope.post_json('jy_weishop/sale.live_myrooms/setgoodstorooms/',scope.pagedata.post);
}
</script>